<!DOCTYPE html>
<html>
<head>
<title></title> <@h.head />
<style type="text/css">
body {
	padding-bottom: 40px;
}

.sidebar-nav {
	padding: 9px 0;
}

@media ( max-width : 980px) {
	/* Enable use of floated navbar text */
	.navbar-text.pull-right {
		float: none;
		padding-left: 5px;
		padding-right: 5px;
	}
}
</style>
</head>
<body>
	<form action="${path}/dict/save" id="fm" method="post"
		class="definewidth m20">
		<div style="text-align: center;" id="errorMsg"></div>
		<input type="hidden" id="id" value="${id!0}" name="id">
		<table class="table table-bordered table-hover definewidth m10">
			<tr>
				<td width="10%" class="tableleft">字段<span class="required">*</span></td>
				<td><input type="text" name="targetColumn" datatype="*"
										nullmsg="请输入表字段！" /> <span class="Validform_checktip">请输入表字段！</span></td>
			</tr>
			<tr>
				<td class="tableleft">显示内容<span class="required">*</span></td>
				<td><input type="text" name="label" datatype="*" nullmsg="请输入显示内容！" /> <span
										class="Validform_checktip">请输入显示内容</span></td>
			</tr>
			<tr>
				<td class="tableleft">值</td>
				<td><input type="text" name="value"  datatype="n"/><span
										class="Validform_checktip">请输入对应值！</span></td>
			</tr>
			<tr>
				<td class="tableleft">描述</td>
				<td><input type="text" name="descrption"  /></td>
			</tr>
			<tr>
				<td class="tableleft">备注</td>
				<td><input type="text" name="remark" /></td>
			</tr>
			<tr>
				<td class="tableleft">排序</td>
				<td><input type="text" name="sort"  datatype="n"/></td>
			</tr>
			<tr>
				<td class="tableleft">状态</td>
				<td><select class="span6 m-wrap" name="disabled">
						<option value="0">启用</option>
						<option value="1">禁用</option>
				</select></td>
			</tr>
			<tr>
				<td class="tableleft"></td>
				<td>
					<button type="submit" class="btn btn-primary" type="button">保存</button>
					&nbsp;&nbsp;
					<button type="button" class="btn btn-success" onclick="javascript:history.go(-1)">返回列表</button>
				</td>
			</tr>
		</table>
	</form>
	<@h.foot />
	<script type="text/javascript">
		$(function() {
			if ($("#id").val() != 0) {
				$.get("${path}/dict/getById/" + $("#id").val(), function(data) {
					var data = eval('(' + data + ')');
					$("#fm").jsonData(data.data);
				})
			};
		});
		var callback = function(data) {
			if (data.status == "0") {
				window.location.href = "${path}/dict/list";
			} else {
				$("#errorMsg").html(data.msg).show();
			}
		}
		$("#fm").validFrom(callback);
	</script>
</body>
</html>